/*
 *  buffer.h
 *  ProducerConsumer
 *
 * Operating Systems Concepts Essentials
 *	Header File for Skeleton Program for buffer
 *
 *  Created by digi on 10/24/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *	
 *	EECE 315
 *	Project #2
 *	
 *	Procucer-Consumer Problem
 *	
 *	Authors:
 *			Mohamed Ali
 *			Donald Cheng
 *			Krzysztof Mazurek
 *			Ishan Sahay
 *	
 *	Date: 24 / Oct / 2012
 *	
 */

/***********************
 Header File for Skeleton Program for buffer 
 ***********************/

#ifndef BUFFER_H_
#define BUFFER_H_ 

#define BUFFER_SIZE 5

//Create Mutex
pthread_mutex_t mutex;  /* this mutex is shared by the thread(s) */


//Create Semaphores
sem_t empty;	/* this semaphore is shared by the thread(s) */
sem_t full;		/* this semaphore is shared by the thread(s) */

/* buffer.h */ 

int emptyIndex = 0; //BUFFER_SIZE - 1;
int fullIndex = 0; //0;

typedef int buffer_item; 
buffer_item buffer[BUFFER_SIZE];

int insert_item(buffer_item item);
int remove_item(buffer_item *item);

#endif
